{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "dce3637a",
   "metadata": {},
   "source": [
    "### HMM\n",
    "\n",
    "一般以文本序列数据为输入，以该序列对应的隐含序列为输出\n",
    "\n",
    "在NLP领域，HMM用来解决文本序列标注问题，如分词、词性标注以及命名实体识别等\n",
    "\n",
    "在训练过程中，为了简化计算，马尔可夫提出一种假设：隐含序列中每个单元的可能性只与上一个单元有关"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "557818d1",
   "metadata": {},
   "source": [
    "#### 训练\n",
    "\n",
    "1. 将HMM模型表示为lambda=HMM(A,B,pi)，其中A为转移概率矩阵，B为发射概率矩阵，pi为初始概率矩阵\n",
    "2. 使用事先准备好的观测序列及其对应的隐含序列训练HMM，使得由观测序列到对应的隐含序列的概率最大\n",
    "\n",
    "\n",
    "#### 验证\n",
    "\n",
    "1. 给定输入序列(x1, x2, ..., xn)，使用计算lambda(x1,x2, ..., xn)\n",
    "2. 使用维特比算法从隐含序列的条件概率分布中找出概率最大的一条序列"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "23d669e1",
   "metadata": {},
   "source": [
    "### CRF"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61a2d0aa",
   "metadata": {},
   "source": [
    "CRF不存在隐马尔可夫假设，因此计算上更慢，但是准确率也相应更高"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "80b85cac",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "torchX",
   "language": "python",
   "name": "torchx"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
